#ifndef _INDEXER_H_
#define _INDEXER_H_

#include "preprocess/parsebundler.h"

#include "opencv2/opencv.hpp"

enum IndexMethod {
  LSH = 0,
  HCT = 1,
  AUTO = 2
};

class Indexer {
private:
  cv::flann::Index mIndexer;
  // search parameters
  int checks;
  float eps;

  std::vector<Point3D> mPutativeMatchesPoints;

public:
  Indexer();
  ~Indexer();

  // load bundler parser pointer
  // void LoadBundlerParser(const BundlerParser* ptr_parser);

  // initialize the flann matcher
  void InitFlannIndexer(const cv::Mat& desc_mat,
                        const std::string& index_file,
                        const IndexMethod index_method = LSH);

  // knn search  k=2; indices is Mat<int> type
  void KnnSearch(const cv::Mat& desc_mat, cv::Mat& indices, cv::Mat& dists, int k = 2);

};


#endif